<template>
    <div>
        <center><h3>个人信息</h3></center>


        <el-form ref="loginForm"  label-width="80px" class="login-box">

            <center><el-upload
                    class="avatar-uploader"
                    action="https://jsonplaceholder.typicode.com/posts/"
                    :show-file-list="false"
                    :on-success="handleAvatarSuccess"
                    :before-upload="beforeAvatarUpload">
                <img v-if="imageUrl" :src="imageUrl" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
                点击上传头像
            </center>
            <br>
            <el-form-item label="账号" class="out"  prop="id">
                <el-input  type="text" class="inputs" placeholder="请输入账号"  />
            </el-form-item>
            <el-form-item label="姓名" class="out"  prop="password">
                <el-input type="text" class="inputs"  placeholder="请输入姓名"/>
            </el-form-item>
            <el-form-item label="身份证号" class="out"  prop="password">
                <el-input type="text" class="inputs" placeholder="请输入身份证号"/>
            </el-form-item>
            <el-form-item label="性别" class="out">
                <el-radio  v-model="radio" label="男">男</el-radio>
                <el-radio v-model="radio" label="女">女</el-radio>
            </el-form-item>

            <el-form-item label="年龄" class="out"  prop="password">
                <el-input type="text" class="inputs" placeholder="请输入身份证号"/>
            </el-form-item>
            <el-form-item label="电话" class="out" prop="password">
                <el-input type="text" class="inputs" placeholder="请输入电话"/>
            </el-form-item>
            <el-form-item label="地址" class="out" prop="password">
                <el-input type="text" class="inputs" placeholder="请选择地址"/>
            </el-form-item>
            <center>
            <el-form-item>
                <el-button type="primary"  >修改</el-button>
            </el-form-item>
            </center>
        </el-form>
    </div>
</template>

<script>
    export default {
        name: "PersonalInf",
        data(){
            return{
                radio: '男',
                imageUrl: ''

            };
        },
        methods: {
            handleAvatarSuccess(res, file) {
                this.imageUrl = URL.createObjectURL(file.raw);
            },
            beforeAvatarUpload(file) {
                const isJPG = file.type === 'image/jpeg';
                const isLt2M = file.size / 1024 / 1024 < 2;

                if (!isJPG) {
                    this.$message.error('上传头像图片只能是 JPG 格式!');
                }
                if (!isLt2M) {
                    this.$message.error('上传头像图片大小不能超过 2MB!');
                }
                return isJPG && isLt2M;
            }
        }
    }
</script>

<style scoped>
    .login-box{

        padding: 10px 35px 15px 35px;

    }
    .out{
        margin-left: 350px;
    }
    .inputs{
        width: 500px;
    }
    .avatar-uploader {
        border: 1px dashed #d9d9d9;
        border-radius: 6px;
        width: 100px;
        height: 100px;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }
    .avatar-uploader .el-upload:hover {
        border-color: #409EFF;
    }
    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 100px;
        height: 100px;
        line-height: 100px;
        text-align: center;
    }
    .avatar {
        width: 100px;
        height: 100px;
        display: block;
    }

</style>